#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;

class Date
{
	friend ostream& operator<<(ostream& _cout, const Date& d);
public:
	Date(int year = 1900, int month = 1, int day = 1)
		: _year(year)
		, _month(month)
		, _day(day)
	{
	}

	bool operator<(const Date& d)const
	{
		return (_year < d._year) ||
			(_year == d._year && _month < d._month) ||
			(_year == d._year && _month == d._month && _day < d._day);
	}

	bool operator>(const Date& d)const
	{
		return (_year > d._year) ||
			(_year == d._year && _month > d._month) ||
			(_year == d._year && _month == d._month && _day > d._day);
	}
private:
	int _year;
	int _month;
	int _day;
};

ostream& operator<<(ostream& _cout, const Date& d)
{
	_cout << d._year << "-" << d._month << "-" << d._day;
	return _cout;
}

class DateLess
{
public:
	bool operator()(Date* p1, Date* p2)
	{
		return *p1 < *p2;
	}
};
//
//int main()
//{
//	int myints[] = { 10,20,30,5,15 };
//	sort(myints, myints + 5);
//	vector<int> v(myints, myints + 5);
//	
//	cout << is_heap(myints, myints + 5)<<endl;
//	
//	cout << is_heap(v.begin(),v.end()) << endl;
//
//	make_heap(v.begin(), v.end());
//	cout << is_heap(myints, myints + 5) << endl;
//
//
//	for (auto e : v)
//	{
//		cout << e << " ";
//	}
//	cout << endl;
//	return 0;
//}

int main()
{
	priority_queue<Date> q1;

	q1.push(Date(2018, 10, 29));
	q1.push(Date(2018, 10, 28));
	q1.push(Date(2018, 10, 28));

	cout << q1.top() << endl;
	q1.pop();
	return 0;
}